<?php
	//error reporting
	ini_set('error_reporting', E_ALL);
	ini_set('display_errors', 1);
	
	//-----------------------------------------------------------------------------------
	include_once("../classes/Database.class.php");
	$db = new Database();
	//-----------------------------------------------------------------------------------


	//-----------------------------------------------------
	extract($_GET);
	if(!empty($username) || !empty($password)){
		$data_array = $db->get_data("users", "*", "username='$username' and password='$password'");
		if(!empty($data_array)){
			session_start();
			$_SESSION["loggedUser"] = serialize($data_array[0]);
			$return = "ok";
		} else {
			$return = "err:bad login";
		}			
	} else {
		$return = "err:incomplete login data";
	}
	
	echo $return;
	//-----------------------------------------------------
?>